@keyframes shake {
  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }

  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }

  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

.shake {
  animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}

.ae-Outline-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  .ae-outline-tabs {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    .ae-outline-tabs-header {
      padding: 0 12px;
    }
    .ae-outline-tabs-content {
      flex: 1;
      min-height: 0;
      margin-top: 12px;
    }
    .ae-outline-tabs-panel.is-active {
      display: flex;
      flex-direction: column;
      height: 100%;
      padding: 0;
    }
  }
}

.ae-Outline {
  // margin-top: 16px;
  padding: 12px 10px 6px 10px;
  --Tree-indent: 16px;
  // width: $Editor-aside-width;

  flex: 1 1 auto;
  background: #fff;

  &-list,
  &-sublist {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  &-list {
    // margin-left: 16px;
  }

  &-sublist {
    // margin-left: 16px;

    > .ae-Outline-node {
      &::before,
      &::after {
        position: absolute;
        content: '';
        background: $editor-border-color;
        display: block;
      }

      &::before {
        width: 8px;
        height: 1px;
        left: calc(var(--indent) * var(--Tree-indent) - 9px);
        top: 12px;
        visibility: hidden; // 隐藏左侧连线（横线）
      }

      &::after {
        width: 1px;
        height: 100%;
        left: calc(var(--indent) * var(--Tree-indent) - 9px);
        top: 0;
        visibility: hidden; // 隐藏左侧连线（竖线）
      }

      &:last-child::after {
        height: 12px;
      }
    }
  }

  &:hover {
    // hover时 显示连接线
    .ae-Outline-node {
      &::before,
      &::after {
        visibility: visible;
      }
    }
  }

  &-node {
    position: relative;
    padding: 0;
    margin: 0;

    > a {
      padding: 0 8px;
      padding-left: calc(var(--indent) * var(--Tree-indent));
      min-width: 108px;

      font-family: PingFangSC-Regular;
      font-size: 12px;
      color: $editor-default-color;
      line-height: 24px;
      font-weight: 400;
      text-decoration: none;
      user-select: none;
      cursor: pointer;
      display: flex;
      flex-direction: row;
      justify-content: flex-start;
      align-items: center;

      &:hover {
        // color: $editor-default-color; // 避免被其他全局样式覆盖
        // background: $hover-bg-color;
      }
    }

    &.has-children > a {
      margin-left: 0;
    }

    > a:hover,
    &.is-hover > a {
      color: $editor-active-color;
      // border-radius: 2px;
    }

    &.is-active {
      background: $active-bg-color;

      > a {
        color: $editor-active-color;

        // border-radius: 2px;
      }
    }

    &.is-folded > .ae-Outline-sublist {
      display: none;
    }

    span.has-keywords {
      color: $editor-active-color;
      font-weight: 600;
    }
  }

  &-textIndent {
    display: inline-block;
    width: 4px;
  }

  &-expander {
    position: relative;
    left: 0;
    // top: 8px;
    cursor: pointer;
    z-index: 2;
    display: inline-flex;
    justify-content: center;
    align-items: center;

    > svg {
      width: 16px;
      height: 16px;
      color: $default-icon-color;
      transform: rotate(0deg);
      transition: transform ease-out 0.1s;
    }

    // &:before {
    //   content: '';
    //   display: inline-block;
    //   width: 0;
    //   height: 0;
    //   border-style: solid;
    //   border-width: 4px 0 4px 6.9px;
    //   border-color: transparent transparent transparent $dark;
    //   transform: rotate(45deg);
    // }

    &.is-folded > svg {
      transform: rotate(-90deg);
    }
  }

  &-tip {
    color: $success;
    margin-bottom: 15px;
    animation: shake 0.82s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
  }

  &-dropNode {
    padding: 25px 0 0 15px;
    margin-bottom: 5px;
    position: relative;
    background: #fff;

    &:after {
      pointer-events: none;
      content: '';
      position: absolute;
      z-index: 2;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      border: 1px dashed $editor-border-color;
    }

    &.is-active {
      &:after {
        border: 1px dashed $editor-active-color;
        z-index: 3;
      }
      color: $editor-default-color;
      background: $active-bg-color;
    }

    > a {
      color: $editor-default-color;
      position: absolute;
      display: block;
      width: 100%;
      left: 5px;
      top: 2px;
      font-size: 12px;
    }
  }
}

.ae-DialogList {
  &-wrap {
    padding: 0 10px;
  }

  list-style: none;
  margin: 8px 0 0;
  padding: 0;

  li {
    &.is-unused {
      color: var(--text--muted-color);
    }

    cursor: pointer;
    margin: 4px 0;
    padding: 4px 10px;
    font-size: 12px;

    display: flex;
    justify-content: space-between;
    gap: px2rem(5px);
    align-items: center;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--colors-neutral-text-2);

    > span {
      flex: 1;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    a.ae-DialogList-iconBtn {
      font-size: inherit;
      color: var(--icon-color);
      text-decoration: none;
      cursor: pointer;

      > svg {
        top: px2rem(1px);
        width: px2rem(16px);
        height: px2rem(16px);
      }

      > svg.icon-copy {
        top: 0;
        width: px2rem(12px);
        height: px2rem(12px);
      }

      &:hover {
        color: var(--icon-onHover-color);
        background: var(--colors-neutral-bg-2);
      }
    }
  }

  // li + li {
  //  border-top: var(--borderWidth) solid var(--borderColor);
  // }

  li:hover {
    color: var(--Layout-fontColor--onHover);
    background: $hover-bg-color;
    // border-top: var(--borderWidth) solid var(--borderColor);
    // border-bottom: var(--borderWidth) solid var(--borderColor);
  }

  &-placeholder {
    color: #b4b6ba;
    padding-top: px2rem(10px);
    text-align: center;
    vertical-align: middle;
  }
}
